package c.e.a.c.l;

import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView.e;
import androidx.recyclerview.widget.RecyclerView.z;
import java.util.Calendar;
import java.util.Locale;

/* compiled from: YearGridAdapter */
public class v extends e<a> {
    public final d<?> c;

    /* compiled from: YearGridAdapter */
    public static class a extends z {
        public final TextView t;

        public a(TextView textView) {
            super(textView);
            this.t = textView;
        }
    }

    public v(d<?> dVar) {
        this.c = dVar;
    }

    public int a() {
        return this.c.Z.e;
    }

    public void f(z zVar, int i) {
        a aVar = (a) zVar;
        int i2 = this.c.Z.a.d + i;
        String string = aVar.t.getContext().getString(2131690099);
        aVar.t.setText(String.format(Locale.getDefault(), "%d", new Object[]{Integer.valueOf(i2)}));
        aVar.t.setContentDescription(String.format(string, new Object[]{Integer.valueOf(i2)}));
        b bVar = this.c.d0;
        Calendar c = t.c();
        a aVar2 = c.get(1) == i2 ? bVar.f : bVar.d;
        for (Long longValue : this.c.Y.o()) {
            c.setTimeInMillis(longValue.longValue());
            if (c.get(1) == i2) {
                aVar2 = bVar.e;
            }
        }
        aVar2.b(aVar.t);
        aVar.t.setOnClickListener(new u(this, i2));
    }

    public z g(ViewGroup viewGroup, int i) {
        return new a((TextView) LayoutInflater.from(viewGroup.getContext()).inflate(2131493018, viewGroup, false));
    }

    public int h(int i) {
        return i - this.c.Z.a.d;
    }
}
